def max_gongyue(a, b):
    while b != 0:
        rem = a % b
        a = b
        b = rem
    return a


def min_gongbei(a, b):
    return a * b / max_gongyue(a, b)


if __name__ == "__main__":
    nums = int(input().strip())
    for i in range(nums):
        line = [map(lambda x: int(x), input().strip().split())]
        for a, b in line:
            if a < b:
                c = a
                a = b
                b = c
            print("case #%d:\n%d" % (i, min_gongbei(a, b)))
